/*This tests the JavaGradeArray class.
 * Written by a student in Mr. Goldman's class
 */
public class JavaGradeArrayTester
{
	public static void main(String args[])
	{
		//Keeps track of the number of errors.
		int errors = 0;
		
		//Creating 1 arrays to be tested.
		JavaGradeArray array = new JavaGradeArray();
		//Testing the addHomework and getHomeworkGrade methods.
		if(array.addHomework(100))
			System.out.println("addHomework Test 1-Success");
		else
		{
			errors += 1;
			System.out.println("addHomework Test 1-ERROR!");
		}
		if(array.addHomework(90))
			System.out.println("addHomework Test 2-Success");
		else
		{
			errors += 1;
			System.out.println("addHomework Test 2-ERROR!");
		}
		if(array.addHomework(80))
			System.out.println("addHomework Test 3-Success");
		else
		{
			errors += 1;
			System.out.println("addHomework Test 3-ERROR!");
		}
		if(array.addHomework(70))
			System.out.println("addHomework Test 4-Success");
		else
		{
			errors += 1;
			System.out.println("addHomework Test 4-ERROR!");
		}
		if(array.addHomework(70))
			System.out.println("addHomework Test 5-Success");
		else
		{
			errors += 1;
			System.out.println("addHomework Test 5-ERROR!");
		}
		if(array.getHomeworkGrade(5) == 70)
			System.out.println("getHomeworkGrade Test 1-Success");
		else
		{
			errors += 1;
			System.out.println("getHomeworkGrade Test 1-ERROR!");
		}
		if(array.getHomeworkGrade(1) == 100)
			System.out.println("getHomeworkGrade Test 2-Success");
		else
		{
			errors += 1;
			System.out.println("getHomeworkGrade Test 2-ERROR!"+array.getHomeworkGrade(1));
		}
		if(array.getHomeworkGrade(0) == -1)
			System.out.println("getHomeworkGrade Fail Test 1-Success");
		else
		{
			errors += 1;
			System.out.println("getHomeworkGrade Fail Test 1-ERROR!");
		}
		if(array.getHomeworkGrade(11) == -1)
			System.out.println("getHomeworkGrade Fail Test 2-Success");
		else
		{
			errors += 1;
			System.out.println("getHomeworkGrade Fail Test 2-ERROR!");
		}
		if(array.getHomeworkGrade(6) == -1)
			System.out.println("getHomeworkGrade Fail Test 3-Success");
		else
		{
			errors += 1;
			System.out.println("getHomeworkGrade Fail Test 3-ERROR!");
		}
		
		//Tests the changeHomeworkGrade and homeworkAverage methods.
		if(array.changeHomework(60,5))
			System.out.println("changeHomework Test 1-Success");
		else
		{
			errors += 1;
			System.out.println("changeHomework Test 1-ERROR!");
		}
		if(array.changeHomework(100,1))
			System.out.println("changeHomework Test 2-Success");
		else
		{
			errors += 1;
			System.out.println("changeHomework Test 2-ERROR!");
		}
		if(!(array.changeHomework(100,11)))
			System.out.println("changeHomework Fail Test 1-Success");
		else
		{
			errors += 1;
			System.out.println("changeHomework Fail Test 1-ERROR!");
		}
		if(!(array.changeHomework(100,6)))
			System.out.println("changeHomework Fail Test 2-Success");
		else
		{
			errors += 1;
			System.out.println("changeHomework Fail Test 2-ERROR!");
		}
		if(array.homeworkAverage() > 79.99 && array.homeworkAverage() < 80.01)
			System.out.println("homeworkAverage Test 1-Success");
		else
		{
			errors += 1;
			System.out.println("homeworkAverage Test 1-ERROR!");
		}
		
		//Testing the addTest and getTestGrade methods.
		if(array.addTest(100))
			System.out.println("addTest Test 1-Success");
		else
		{
			errors += 1;
			System.out.println("addTest Test 1-ERROR!");
		}
		if(array.addTest(90))
			System.out.println("addTest Test 2-Success");
		else
		{
			errors += 1;
			System.out.println("addTest Test 2-ERROR!");
		}
		if(array.addTest(80))
			System.out.println("addTest Test 3-Success");
		else
		{
			errors += 1;
			System.out.println("addTest Test 3-ERROR!");
		}
		if(array.addTest(70))
			System.out.println("addTest Test 4-Success");
		else
		{
			errors += 1;
			System.out.println("addTest Test 4-ERROR!");
		}
		if(array.addTest(70))
			System.out.println("addTest Test 5-Success");
		else
		{
			errors += 1;
			System.out.println("addTest Test 5-ERROR!");
		}
		if(array.getTestGrade(5) == 70)
			System.out.println("getTestGrade Test 1-Success");
		else
		{
			errors += 1;
			System.out.println("getTestGrade Test 1-ERROR!");
		}
		if(array.getTestGrade(1) == 100)
			System.out.println("getTestGrade Test 2-Success");
		else
		{
			errors += 1;
			System.out.println("getTestGrade Test 2-ERROR!");
		}
		if(array.getTestGrade(0) == -1)
			System.out.println("getTestGrade Fail Test 1-Success");
		else
		{
			errors += 1;
			System.out.println("getTestGrade Fail Test 1-ERROR!");
		}
		if(array.getTestGrade(11) == -1)
			System.out.println("getTestGrade Fail Test 2-Success");
		else
		{
			errors += 1;
			System.out.println("getTestGrade Fail Test 2-ERROR!");
		}
		if(array.getTestGrade(6) == -1)
			System.out.println("getTestGrade Fail Test 3-Success");
		else
		{
			errors += 1;
			System.out.println("getTestGrade Fail Test 3-ERROR!");
		}
		
		//Tests the changeTestGrade and testAverage methods.
		if(array.changeTest(60,5))
			System.out.println("changeTest Test 1-Success");
		else
		{
			errors += 1;
			System.out.println("changeTest Test 1-ERROR!");
		}
		if(array.changeTest(90,1))
			System.out.println("changeTest Test 2-Success");
		else
		{
			errors += 1;
			System.out.println("changeTest Test 2-ERROR!");
		}
		if(!(array.changeTest(100,11)))
			System.out.println("changeTest Fail Test 1-Success");
		else
		{
			errors += 1;
			System.out.println("changeTest Fail Test 1-ERROR!");
		}
		if(!(array.changeTest(100,6)))
			System.out.println("changeTest Fail Test 2-Success");
		else
		{
			errors += 1;
			System.out.println("change Fail Test 2-ERROR!");
		}
		if(array.testAverage() > 77.99 && array.testAverage() < 78.01)
			System.out.println("testAverage Test 1-Success");
		else
		{
			errors += 1;
			System.out.println("testAverage Test 1-ERROR!");
		}
		
		//Tests the overallGrade, overallLetterGrade, and toString (moded) methods.
		if(array.overallGrade() > 78.49 && array.overallGrade() < 78.51)
			System.out.println("overallGrade Test 1-Success");
		else
		{
			errors += 1;
			System.out.println("overallGrade Test 1-ERROR!");
			System.out.println(array.overallGrade());
		}
		if(array.overallLetterGrade().equals("C"))
			System.out.println("overallLetterGrade Test 1-Success");
		else
		{
			errors += 1;
			System.out.println("overallLetterGrade Test 1-ERROR!");
		}
		if(array.toString().equals("JavaGrade = C"))
			System.out.println("toString Test 1-Success");
		else
		{
			errors += 1;
			System.out.println("toString Test 1-ERROR!");
		}

		
		//Prints the numbers of errors.
		System.out.println("There were " + errors + " errors with the class.");
	}
}